my_tuple = (1, 2, 3)
a, b, c = my_tuple
print(a)  # 输出: 1
print(b)  # 输出: 2
print(c)  # 输出: 3

person = ("David", 35, "Engineer")
name,_, occupation = person
print(f"姓名:{name},取业：{occupation}")

person = ("Eve", 28, "Artist", "Nev/ York")
name, age, *details = person
print(f"姓名：{name},牟龄：{age},其他细节:{details}")


my_list = [4, 5, 6]
x, y, z = my_list
print(x)  # 输出: 4
print(y)  # 输出: 5
print(z)  # 输出: 6







my_dict = {"name": "Alice", "age": 30}
name, age = my_dict["name"], my_dict["age"]
print(name)  # 输出: Alice
print(age)   # 输出: 30

dict_data = {'name': 'Alice', 'age': 30}  # 创建一个字典
a, b = dict_data.values()  # 解包字典的值
print(a)  # 输出：Alice
print(b)  # 输出：30

dic = {
    "赵四": "特别能歪嘴",
    "刘能": "老, 老四啊...",
    "大脚": "跟这个和那个搞对象",
    "大脑袋": "瞎折腾....",
}
print(dic.items())    #确定,dic.items()中只有两项元素
#输出结果 dict_items([('赵四', '特别能歪嘴'), ('刘能', '老, 老四啊...'), ('大脚', '跟这个和那个搞对象'), ('大脑袋', '瞎折腾....')])
for k, v in dic.items():  # 可以直接拿到字典的所有的key和value
    print(k, v)



my_list = [1, 2, 3, 4, 5]
a, *rest = my_list
print(a)    # 输出: 1
print(rest) # 输出: [2, 3, 4, 5]

first, *middle, last = my_list
print(first)  # 输出: 1
print(middle) # 输出: [2, 3, 4]
print(last)   # 输出: 5


set_data = {'w', "x", "y", "z"}  # 创建一个集合
a, b, c, d = set_data  # 解包集合
print(a)  # 随机输出一个，取决于集合的内部实现
print(b)  # 同上
print(c)  # 同上
print(d)  # 同上


def my_function():
    return 1, 2, 3
result1, result2, result3 = my_function()
print(result1, result2, result3)  # 输出: 1 2 3